﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Entity;
using DataAccess;

namespace StudentAttendanceChecking
{
    public partial class frmReport : Form
    {
        dsReport baocao;
        public frmReport()
        {
            InitializeComponent();
        }

        private void frmReport_Load(object sender, EventArgs e)
        {
            //try
            //{
            //    Classs class1 = new Classs();
            //    class1.ClassID = frmViewReport.cl;
            //    Subjects sub = new Subjects();
            //    sub.SubjectCode = frmViewReport.su;
            //    Branch branch = new Branch();
            //    branch.BranchID = frmViewReport.br;
            //    rptReport document = new rptReport();
            //    baocao = new dsReportTableAdapters.spViewStudentTableAdapter().GetData(branch.BranchID,class1.ClassID, sub.SubjectCode);
            //    document.SetDataSource((DataTable)baocao);
            //    for (int i = 0; i < baocao.Columns.Count; i++)
            //    {
            //        document.DataDefinition.FormulaFields[i].Text = string.Format("{{spViewStudent.{0}}}", baocao.Columns[i].ColumnName);
            //        ((CrystalDecisions.CrystalReports.Engine.TextObject)document.ReportDefinition.ReportObjects[string.Format("Text{0}", i + 1)]).Text = baocao.Columns[i].ColumnName;
            //    }
            //    crystalReportViewer1.ReportSource = document;
            //}
            //catch (Exception)
            //{
            //    MessageBox.Show("Can not found Subject");
            //    crystalReportViewer1.ReportSource = null;
            //}
        }
    }
}
